<?
$currentPage = $this->pageInfo['page'];
$totalPages = $this->pageInfo['total_page'];
$totalItems = $this->pageInfo['total_item'];

$from=$currentPage-5;

$pageStart = 0;

if ($from<$pageStart)
{
	$from=$pageStart;
}
$to=$currentPage+5;
if ($to > $totalPages+$pageStart-1)
{
	$to=$totalPages+$pageStart-1;
}
if ($this->ext_param)
{
	$ext_param=$this->ext_param;
}
else
{
	$ext_param="";
}

?>
<div class="pageViewWrap">
  <div class="count">Tổng số <?echo number_format($totalItems, 0, ",", ".")?> <?php echo $this->title;?>/ <?echo (int)$totalPages?> trang.</div>
  <div class="pageView text-center"> 
  	<?
	if ($currentPage>=1)
	{
		echo $this->pagerLink($this->url, $ext_param, $pageStart, '|&lt;', "Về trang đầu tiên")."\n";
		echo $this->pagerLink($this->url, $ext_param, $currentPage -1, '&lt;&lt;', "Về trang trước")."\n";
	}?>
  	<?php 
  	if ($from>$pageStart)
	{
		echo "<span>...</span>\n";
	}
	for ($page=$from; $page<=$to; $page++)
	{
		if ($page==$currentPage)
		{
			echo '<span class="itemS">' . ($currentPage+1-$pageStart) . '</span> '."\n";
		}
		else{
			echo $this->pagerLink($this->url, $ext_param, $page, $page+1-$pageStart, $page+1-$pageStart)."\n";
		}
	}
	if ($to<$totalPages+$pageStart-1)
	{
		echo "<span>...</span>\n";
	}
  	?>
  	<?php if ($currentPage<$totalPages+$pageStart-1)
	{
		echo $this->pagerLink($this->url, $ext_param, $currentPage + 1, '&gt;&gt;', "Về trang sau")."\n";
		echo $this->pagerLink($this->url, $ext_param, $totalPages+$pageStart-1, '&gt;|', "Về trang cuối")."\n";
	}
	?>
    <div class="clear"></div>
  </div>
</div>